/** When your routing table is too long, you can split it into small modules**/
import home from "@v/home/index/index.vue"
import user from "@v/user/index/index.vue"
import login from "@v/login/index.vue"
import register from "@v/register/register.vue"
import StudentRegister from "@v/register/studentRegister.vue"

const routes = [
    {
        path: "/",
        redirect: "/home",
        meta: {
            title: "默认首页",
            isLogin: false,
            alive: true
        }
    }, {
        path: "/home",
        name: "home",
        component: home,
        meta: {
            title: "首页",
            isLogin: false,
            alive: true
        }
    }, {
        path: "/register",
        name: "register",
        component: register,
        meta: {
            title: "注册",
            isLogin: false,
            alive: true
        },
        children: [ {
            path: "/register",
            redirect: "/register/studentRegister",
            meta: {
                title: "学生注册",
                isLogin: false,
                alive: true
            }
        },{
            path: "studentRegister",
            name: "studentRegister",
            component: StudentRegister,
            meta: {
                title: "学生注册",
                isLogin: false,
                alive: true
            }
        },{
            path: "parentRegister",
            name: "parentRegister",
            component: () => import ("@v/register/parentRegister.vue"),
            meta: {
                title: "家长注册",
                isLogin: false,
                alive: true
            }
        },{
            path: "schoolRegister",
            name: "schoolRegister",
            component: () => import ("@v/register/schoolRegister.vue"),
            meta: {
                title: "学校注册",
                isLogin: false,
                alive: true
            }
        },{
            path: "educatorRegister",
            name: "educatorRegister",
            component: () => import ("@v/register/educatorRegister.vue"),
            meta: {
                title: "教育工作者注册",
                isLogin: false,
                alive: true
            }
        }]
    }, {
        path: "/detail",
        name: "detail",
        component: () => import("@/views/goods/detail/index.vue"),
        meta: {
            title: "详情",
            isLogin: false,
            alive: true
        }
    }, {
        path: "/favorites",
        name: "favorites",
        component: () => import("@v/favorites/index.vue"),
        meta: {
            title: "收藏夹",
            isLogin: true,
            alive: true
        }
    }, {
        path: "/cart",
        name: "cart",
        component: () => import("@/views/cart/index/index.vue"),
        meta: {
            title: "购物车",
            isLogin: true,
            alive: true
        }
    }, {
        path: "/order",
        name: "order",
        component: () => import("@/views/order/index/index.vue"),
        meta: {
            title: "订单",
            isLogin: true,
            alive: true
        }
    }, {
        path: "/user",
        name: "user",
        component: user,
        meta: {
            title: "用户中心",
            isLogin: true,
            alive: true
        },
        children: [{
            path: '/user',
            redirect: "/user/userHome",
            meta: {
                title: "用户中心-首页",
                isLogin: true,
                alive: true
            }
        }, {
            path: "userHome",
            name: "userHome",
            component: () => import("@v/user/userHome/user.home.vue"),
            meta: {
                title: "用户中心-首页",
                isLogin: true,
                alive: true
            }
        }, {
            path: "userOrder",
            name: "userOrder",
            component: () => import("@v/user/userOrder/user.order.vue"),
            meta: {
                title: "用户中心-我的订单",
                isLogin: true,
                alive: true
            }
        }, {
            path: "userInvoice",
            name: "userInvoice",
            component: () => import("@v/user/userInvoice/user.invoice.vue"),
            meta: {
                title: "用户中心-我的发票",
                isLogin: true,
                alive: true
            }
        }, {
            path: "userCollect",
            name: "userCollect",
            component: () => import("@v/user/userCollect/user.collect.vue"),
            meta: {
                title: "用户中心-我的收藏",
                isLogin: true,
                alive: true
            }
        }]
    }, {
        path: "/login",
        name: "login",
        component: login,
        meta: {
            title: "登录",
            isLogin: false,
            alive: true
        },
        hidden: true
    },
    // {
    //   path: "*",
    //   redirect: "/404", // 404 page must be placed at the end !!!
    //   hidden: true
    // },
    {
        path: "/404",
        component: () => import("@/views/404.vue"),
        meta: {
            title: "404",
            isLogin: false,
            alive: true
        },
        hidden: true
    }
]

export default routes
